/*******************************************
Module: zt_time.c
E-Mail: 24zhutian@gmail.com
Notices: Copyright (c) 2007-2011 ls
*******************************************/
#include "zt_config.h"
#include "zt_time.h"
#include <time.h>
#include <sys/timeb.h>

#ifdef _MSC_VER
ZT_API int zt_gettimeofday(struct timeval *tv, struct timezone *tz)
{
	struct _timeb tb;
    
    /* get current time */
    _ftime(&tb);
    /* set the timeval struct */
    tv->tv_sec = tb.time;
    tv->tv_usec = 1000 * tb.millitm;
    if(tz == NULL){
        return 0;
	}
    /* set the tiemzone struct */
    //tz->tz_minuteswest = tb.timezone;
    //tz->tz_dsttime = tb.dstflag;

    return 0;
}
#endif